package cn.edu.njnu.opengmpback.Modeling.dao;

import cn.edu.njnu.opengmpback.Modeling.entity.ConceptMaterial;
import cn.edu.njnu.opengmpback.Modeling.entity.Project;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * @Description
 * @Auther wyjq
 * @Date 2022/4/6
 **/
@Repository
public interface ProjectDao extends MongoRepository<Project, String> {

    List<Project> findAllByCreatorId(String userId);

    Page<Project> findAllByNameLikeIgnoreCase(String searchText, Pageable pageable);

    Page<Project> findAllByMemberListContains(String userId, Pageable pageable);

    List<Project> findAllByMemberListContains(String userId);

    Page<Project> findAllByCreatorId(String userId, Pageable pageable);

    Page<Project> findAllByMemberListContainsAndCreatorIdNot(String userId, String creatorId, Pageable pageable);
}
